package com.alien.admin.utils;

import cn.hutool.extra.template.Template;
import cn.hutool.extra.template.TemplateEngine;

import java.util.Map;

/**
 * @description: 字符串模板替换
 * @author: zhouseyi
 * @date: 2021/9/28 15:49
 * @version: 1.0
 */
public class TemplateStrUtil {

    public static String generate(String templateStr, Map<String ,Object> params) {
        TemplateEngine engine = cn.hutool.extra.template.TemplateUtil.createEngine();
        Template template = engine.getTemplate(templateStr);
        String result = template.render(params);
        return result;
    }
}
